Windows and Linux Penetration Testing from Scratch, Second Edition by Phil Bramwell

Windows and Linux Penetration Testing from Scratch, Second Edition by Phil Bramwell

Author:Phil Bramwell
Language: eng
Format: epub, mobi
Publisher: Packt Publishing Ltd.
Published: 2022-08-03T00:00:00+00:00


Why Python?

Python is an ideal choice for many reasons, but two elements of its design philosophy make it ideal for our goal of becoming an advanced pen tester—its power (it was originally designed to appeal to Unix/C hackers) coupled with its emphasis on readability and reusability. As a professional, you’ll be working with others (don’t plan on the black-hat lone-wolf mentality in this field); Python is one of the few languages where sharing your handy tool with a colleague will likely not result in follow-up what the heck were you thinking? emails to understand your constructs.

Perhaps most importantly, Python is one of those things that you may find on a target embedded well behind the perimeter of your client’s network. You’ve pivoted your way in, and you find yourself on a juicy internal network, but the hosts you land on don’t have the tools you need. It’s surprising how often you’ll find Python installed in such environments. On top of that, you’ll always find a Python-aware text editor on any compromised Linux box. We’ll discuss editors next.

A core concept in Python that makes it the number one choice of hackers is modules. A module is a simple concept, but with powerful implications for the Python programmer. A module is nothing more than a file that contains Python code whose functionality can be brought into your code with the import statement. With this functionality, all attributes (or perhaps a specific attribute) of the module become referenceable in your code. You can also use from [module] import to pick and choose the attributes you need. There is a tremendous number of modules written by clever people from around the world, all ready for you to place in the import search path so that you can bring in any attribute you desire to do some work in your code. The end result? A compact and highly readable chunk of Python that does some tremendous things.

At the time of writing this chapter, Python 3 is the latest and greatest, and anyone still using Python 2 for production tasks is being strongly encouraged to get familiar with Python 3. A handy Python tool called 2to3 will translate your Python 2 into Python 3. We’ll explore configuring your global installation to a specific version for backwards compatibility in Chapter 12, Shellcoding - Evading Antivirus. Now that we’re familiar with the basics, let’s get familiar with the Python editor on Kali.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.